//
//  DataSource.h
//  lvtu
//
//  Created by Apple on 12-4-4.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "TripInfo.h"
#import "MessageInfo.h"
#import "UserInfo.h"

//提交数据需要的参数
#define LVTU_CLIENT_VERSION @"1.2.0"

#define LVTU_CHANNEL @"iphone_appstore"
//#define LVTU_CHANNEL @"iphone_91"
//#define LVTU_CHANNEL @"iphone_weiphone"
//#define LVTU_CHANNEL @"iphone_pp"
//#define LVTU_CHANNEL @"iphone_wxlvtu"
//#define LVTU_CHANNEL @"iphone_weibo"
//#define LVTU_CHANNEL @"iphone_tongbu"

#define UpdateCitySelect @"UpdateCitySelect"
#define UpdateEventChoice @"UpdateEventChoice"

@interface DataSource : NSObject
{
    UserInfo* userInfo;
    MessageInfo* messageInfo;
    NSMutableArray* cityArray;
    NSMutableDictionary* cityDict;
    CityInfo* defaultCityInfo;
    
    TripInfo* creatTripInfo;
    NSString* currentDate;
    
    TripInfo* editTripInfo;
    NSString* editCurrentDate;
    
    BOOL isEdit;
    BOOL isEditDataChanged;
}

@property (nonatomic, retain)UserInfo* userInfo;
@property (nonatomic, retain)MessageInfo* messageInfo;
@property (nonatomic, retain)NSMutableArray* cityArray;
@property (nonatomic, retain)NSMutableDictionary* cityDict;
@property (nonatomic, retain)CityInfo* defaultCityInfo;
@property (nonatomic, retain)TripInfo* creatTripInfo;
@property (nonatomic, retain)TripInfo* editTripInfo;
@property (nonatomic, assign)BOOL isEdit;
@property (nonatomic, assign)BOOL isEditDataChanged;

+ (DataSource*)shareInstance;

- (void)initData;

- (NSString *)file_getAppCachePath;

#pragma mark - 系统相关
- (NSString *)sys_getDeviceID;
- (NSString *)sys_getOSVersion;
- (NSString *)sys_getDeviceModelName;
#pragma mark - 加解密相关
//! ------------------------------
//  加解密相关
//! ------------------------------
//! 将字符串转换为md5
- (NSString *)md5_hexDigest:(NSString *)input;//md5HexDigest

-(void)setCityList:(NSMutableArray *)cityList;
-(NSMutableArray *)getCityList;

#pragma mark - 旅途相关
- (void)resetData;
- (NSString*)getCurrentDate;
- (NSInteger)getDateCount;
- (NSInteger)getTotleEventCount;
- (void)setDate:(NSString*)date;
- (void)creatNextDate:(NSString*)date;
- (NSString*)getDefaultCityId;
- (void)setCurrentCityinfo:(CityInfo*)Info;
- (NSMutableArray*)getCurrentEvent;
- (void)setCurrentEvent:(PlaceInfo*)eventInfo;
- (void)delCurrentEvent:(PlaceInfo*)eventInfo;
- (void)delCurrentEventAll;

- (NSMutableString*)newTripJSONString;

- (LoginInfo*)getUserStatsFromKeyChain;
- (void)saveUserStatusToKeyChain:(NSString *)userName passwd:(NSString *)passWord;

@end
